using Lzfy_His_Service.Models;

namespace Lzfy_His_Service.Services
{
    /// <summary>
    /// 退款审核工作记录服务接口
    /// </summary>
    public interface IRefundAcctService
    {
        /// <summary>
        /// 根据ID获取退款审核工作记录
        /// </summary>
        /// <param name="id">记录ID</param>
        /// <returns>退款审核工作记录响应</returns>
        Task<RefundAcctResponse?> GetByIdAsync(int id);

        /// <summary>
        /// 根据结算ID获取退款审核工作记录
        /// </summary>
        /// <param name="acctId">结算ID</param>
        /// <returns>退款审核工作记录响应</returns>
        Task<RefundAcctResponse?> GetByAcctIdAsync(string acctId);

        /// <summary>
        /// 根据用户名获取退款审核工作记录列表
        /// </summary>
        /// <param name="username">用户名</param>
        /// <returns>退款审核工作记录响应列表</returns>
        Task<IEnumerable<RefundAcctResponse>> GetByUsernameAsync(string username);

        /// <summary>
        /// 获取所有退款审核工作记录
        /// </summary>
        /// <returns>退款审核工作记录响应列表</returns>
        Task<IEnumerable<RefundAcctResponse>> GetAllAsync();

        /// <summary>
        /// 分页获取退款审核工作记录
        /// </summary>
        /// <param name="pageNumber">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="username">用户名过滤（可选）</param>
        /// <param name="acctId">结算ID过滤（可选）</param>
        /// <param name="startDate">开始日期过滤（可选）</param>
        /// <param name="endDate">结束日期过滤（可选）</param>
        /// <returns>分页结果</returns>
        Task<(IEnumerable<RefundAcctResponse> Items, int TotalCount)> GetPagedAsync(
            int pageNumber, 
            int pageSize, 
            string? username = null, 
            string? acctId = null, 
            DateTime? startDate = null, 
            DateTime? endDate = null);

        /// <summary>
        /// 创建退款审核工作记录
        /// </summary>
        /// <param name="request">创建请求</param>
        /// <returns>创建的记录响应</returns>
        Task<RefundAcctResponse> CreateAsync(RefundAcctCreateRequest request);

        /// <summary>
        /// 更新退款审核工作记录
        /// </summary>
        /// <param name="request">更新请求</param>
        /// <returns>更新的记录响应</returns>
        Task<RefundAcctResponse?> UpdateAsync(RefundAcctUpdateRequest request);

        /// <summary>
        /// 删除退款审核工作记录
        /// </summary>
        /// <param name="id">记录ID</param>
        /// <returns>是否删除成功</returns>
        Task<bool> DeleteAsync(int id);

        /// <summary>
        /// 检查结算ID是否存在
        /// </summary>
        /// <param name="acctId">结算ID</param>
        /// <returns>是否存在</returns>
        Task<bool> ExistsAsync(string acctId);

        /// <summary>
        /// 获取用户的退款审核工作统计信息
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="startDate">开始日期（可选）</param>
        /// <param name="endDate">结束日期（可选）</param>
        /// <returns>统计信息</returns>
        Task<(int TotalCount, decimal TotalAmount)> GetUserStatisticsAsync(
            string username, 
            DateTime? startDate = null, 
            DateTime? endDate = null);

        /// <summary>
        /// 批量创建退款审核工作记录
        /// </summary>
        /// <param name="requests">创建请求列表</param>
        /// <returns>创建的记录响应列表</returns>
        Task<IEnumerable<RefundAcctResponse>> BatchCreateAsync(IEnumerable<RefundAcctCreateRequest> requests);

        /// <summary>
        /// 根据日期范围获取统计报表
        /// </summary>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <returns>统计报表数据</returns>
        Task<object> GetStatisticsReportAsync(DateTime startDate, DateTime endDate);
    }
}